home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
TSPA3470
/
TSUNTA.INT
< prev
next >
Wrap
Text File
|
1994-08-16
|
5KB
|
112 lines
(*
Timo Salmi UNiT A
A Turbo Pascal unit for sideways scrolling (panning)
All rights reserved 22-Jul-89
Updated 28-Jul-89, 19-Aug-89, 17-Mar-90, 15-Jul-90
The compiler tp 4.0 / 5.0 / 5.5 compatible directives which were used at
complile-time as show below:
*)
{$B-} (* Short circuit boolean evaluation *)
{$D-} (* No bebug information *)
{$F-} (* Force far calls off *)
{$I+} (* Input/output checking on *)
{$N-} (* No numeric coprocessor *)
{$R-} (* No range-checking *)
{$S+} (* Stack overflow checking *)
{$V+} (* Strict var-string checking *)
(*
There are many excellent (mostly commercial) Turbo Pascal units available,
such as Turbo Power's Turbo Professional with hosts of useful procedures
and functions. However, I have not come upon procedures which would scroll
a screen, or part of the screen, SIDEWAYS. So here is a Turbo Pascal unit
for vertical scrolling. It uses direct moves of memory, and is very fast.
Because of this method, the older CGAs may experience snow.
This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
NON-INSTITUTIONAL purposes, provided it is not changed in any way, and
that a proper attribution is made. For ANY other usage, such as use in a
business enterprise or at a university, contact the author for the terms
of registration.
The units are under development. Comments and contacts are solicited. If
you have any questions, please do not hesitate to use electronic mail for
communication.
InterNet address: ts@uwasa.fi
The author shall not be liable to the user for any direct, indirect or
consequential loss arising from the use of, or inability to use, any unit,
program or file howsoever caused. No warranty is given that the units and
programs will work under all circumstances.
Timo Salmi
Professor of Accounting and Business Finance
Faculty of Accounting & Industrial Management; University of Vaasa
P.O. BOX 297, FIN-65101 Vaasa, Finland
*)
unit TSUNTA;
(* ======================================================================= *)
interface
(* ======================================================================= *)
uses Dos,
Crt,
TSUNTE;
(* Procedure for vertical scrolling moving right.
The area to be panned is defined by x1, y1, x2, y2.
The move sideways can be taken in strides by defining a step > 1.
If the parameters are invalid (say x1 = 100), the program is
aborted with and error message. Step = 0 is invalid.
Use in text mode only.
The width 40/80 of the text mode is detected by the unit unless
you toggle the texmode.
The (maximum) hight is 25 rows.
*)
procedure PANMR (x1, y1, x2, y2, step : byte);
(* Procedure for vertical scroll moving left *)
procedure PANML (x1, y1, x2, y2, step : byte);
(* The width of the text screen
You do not necessarily need this in using panmr and panml because they
take care of the width themselves. Consider it a perk :-) *)
function WIDTHFN : byte;
(* This is supposed to be the height of the text screen. Actually, it seems
to give the resolution 25, 43, or 50. Whether that is the true height
of the screen depends on your application. This function is has no
connection with panning. It is here because it best belongs to this unit
along with widthfn *)
function HIGHTFN : byte;
(*
Each of the 80x25 (or 40x25) locations of a text-screen have in video
memory an information byte on the character and its attribute, that is
color starting from 0 black, 1 blue, and so on. Here are the means of
access. One particularly useful trick is to write to location 80,25
directly, since then the screen will not scroll as it would were you
to use GoToXY (80,25); write ('X'); Furthermore, direct screen writes
enable writing the ascii 0-31 characters without their special meaning.
This fact can be utilized to widen the displayable character set.
*)
(* A function to calculate a color attribute for VIDXY *)
function ATTRIBFN (fgColor, bgColor : byte) : byte;
(* Write a single character ch at (column,row) using attribute,
directly to the video memory. If you do not know how the attribute
is defined for video memory, use the attribfn function *)
procedure VIDXY (column, row : byte; ch : char; attrib : byte);
(* Read a single character from video memory *)
function VDCHXYFN (column, row : byte) : char;
(* Read a single attribute from video memory *)
function VDATXYFN (column, row : byte) : byte;